function fval = smm(param,dtarget,scaler)

    %Data moments (control means and weight matrices)
    DatM = dtarget{1,1};
    W = dtarget{2,1};
   
    %Simulated moments
    [E_S,~,~,~,~,TE_2]=smom_function(param);
    
    %Extract the relevant periods from employment rate moments
    E_Se = E_S(:,1); 
    TE_2e = TE_2;
    
    %Stack the level moments and the TEs, scale TE's 
    SimM = [E_Se;scaler.*TE_2e];
    
    %SMM objective function
    m = SimM - DatM;
    fval = m'*W*m;
    
end

